home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / March 96 / Re Setting Context.1 < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.3 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Setting Context
  2. Sent:        3/11/96 1:45 PM
  3. Received:    3/11/96 1:01 PM
  4. From:        Damon Cokenias, cokenias@mtn-palace.com
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. (I sent this Sunday night, but didn't see it on the list.  If it doesn't
  9. show up this time, I'm going to panic.)
  10.  
  11. ------
  12.  
  13. >Henri & team,
  14. >I have a part which is based on ODF Draw (d11).  Within my content view,
  15. >I've embedded some subframes.
  16. >
  17. >I'm trying to understand the correct way to set the context so I can render
  18. >within these subframes.  I've tried using FW_CViewContext,
  19. >FW_CFacetContext, and FW_CPlatformGraphicContext (individually, of course).
  20. >I want to set the context and then render within the frame using a mix of
  21. >ODF rendering methods and native calls.  I would expect that after setting
  22. >the context, my rendering would be clipped to the subframe and all of my
  23. >rendering would also be relative to the subframe (nominally the topLeft
  24. >corner).
  25.  
  26. You should probably render within these subframes from within the
  27. subframe's Draw method.  I have a part which embeds itself as a subframe
  28. (using a different presentation, of course).  I use the
  29.  
  30. void CMySubFrame::Draw (Environment* ev, ODFacet* odFacet, ODShape*
  31. invalidShape)
  32. {
  33.     FW_CViewContext  vc (ev, this, odFacet, invalidShape);
  34.     FW_CRectShape::RenderRect (vc, GetBounds(ev), FW_kFill, FW_CColor
  35. (0xF0, 0xF0, 0xF0));
  36. }
  37.  
  38. This works because, of course, an FW_CFrame is also a FW_CView.  I don't
  39. recommend drawing into your subframes from your main frame's Draw method (I
  40. infer this is what you are doing).  This is going behind OpenDoc's back and
  41. is trickier than it needs to be.
  42.  
  43. In my opinion, one of the big reasons to have subframes in the first place
  44. is to take advantage of the seperate Draw messages.
  45.  
  46. If I misunderstood your posting, or if you have a compelling reason to do
  47. all of your drawing within one method, let us know.
  48.  
  49. -Damon Cokenias
  50. ODF Team
  51.  
  52.  
  53. +-----------------------------------------------------------------------+
  54. |   /\    Damon Cokenias                                                |
  55. |  /^^\   cokenias@mtn-palace.com                                       |
  56. | /____\  Visit the Mountain Palace at http://www.netgate.net/~cokenias |
  57. +-----------------------------------------------------------------------+
  58.  
  59.